package cn.com.yusys.yusp.mobile.service;

import cn.com.yusys.yusp.commons.mapper.CommonMapper;
import cn.com.yusys.yusp.commons.mapper.QueryModel;
import cn.com.yusys.yusp.commons.service.CommonService;
import cn.com.yusys.yusp.mobile.repository.mapper.WcrmCustRemindInfoMapper;
import cn.com.yusys.yusp.mobile.repository.mapper.WcrmDocuCustSumZhMapper;
import com.github.pagehelper.PageHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 领导驾驶舱
 * @author zoie
 */
@Service("wcrmDocuCustSumZhService")
public class WcrmDocuCustSumZhService extends CommonService {

    private static Logger logger = LoggerFactory.getLogger(WcrmDocuCustSumZhService.class);
    @Resource
    private WcrmDocuCustSumZhMapper wcrmDocuCustSumZhMapper;

    @Override
    protected CommonMapper getMapper() {
        return null;
    }

    /**
     * 建档客户数看板
     * @return
     */
    public Map<String, Object> queryDocumentCusNum() {
        Map<String, Object> map = wcrmDocuCustSumZhMapper.queryDocumentCusNum();
        return map;
    }

    /**
     * 客户贡献分级
     * @return
     */
    public List<Map<String, Object>> queryCusContributeLevel() {
        return wcrmDocuCustSumZhMapper.queryCusContributeLevel();
    }

    /**
     * 客户趋势
     * @return
     */
    public Map<String,Object> queryCusTrend() {
        Map<String,Object> map =new HashMap<>(2);
        List<Map<String,Object>> documentList = wcrmDocuCustSumZhMapper.queryDocumentList();
        List<Map<String,Object>> cusList = wcrmDocuCustSumZhMapper.queryCusList();
        map.put("documentList",documentList);
        map.put("cusList",cusList);
        return map;
    }

    /**
     * 存款趋势
     * @return
     */
    public List<Map<String, Object>> queryDepBalList() {
        return wcrmDocuCustSumZhMapper.queryDepBalList();
    }

    /**
     * 贷款趋势
     * @return
     */
    public List<Map<String, Object>> queryLoanBalList() {
        return wcrmDocuCustSumZhMapper.queryLoanBalList();
    }

    /**
     * 建档数支行排名
     * @param queryModel
     * @return
     */
    public List<Map<String, Object>> queryDocumentRank(QueryModel queryModel) {
        // 设置分页查询参数(设置到线程变量中了)
        PageHelper.startPage(queryModel.getPage(), queryModel.getSize());
        List<Map<String, Object>> list = wcrmDocuCustSumZhMapper.queryDocumentRank(queryModel);
        PageHelper.clearPage();
        return list;
    }

    /**
     * 转换量支行排名
     * @param queryModel
     * @return
     */
    public List<Map<String, Object>> queryConverRank(QueryModel queryModel) {
        // 设置分页查询参数(设置到线程变量中了)
        PageHelper.startPage(queryModel.getPage(), queryModel.getSize());
        List<Map<String, Object>> list = wcrmDocuCustSumZhMapper.queryConverRank(queryModel);
        PageHelper.clearPage();
        return list;
    }
}